<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class SuggestController extends BaseController {

	public function index() {
        $data = array_filter($_GET);
        unset($data['p']);
        $count = M('suggest')->field('s.*,u.user_nickname')->alias('s')->join('left join midi_user as u on s.suggest_user_id = u.user_id')->where($data)->count();
        $page = getpage($count,10);
        $suggest_arr = M('suggest')->field('s.*,u.user_nickname')->alias('s')->join('left join midi_user as u on s.suggest_user_id = u.user_id')->where($data)->order('suggest_id desc')->limit($page->firstRow, $page->listRows)->select();
        $this->assign('suggest_arr', $suggest_arr);
        $this->assign('page', $page->show());
        $this->display();
    }
    
    public function suggest_details(){
        $suggest_arr = M('suggest')->field('s.*,u.user_nickname,u.user_name,u.user_phone')->alias('s')->join('left join midi_user as u on s.suggest_user_id = u.user_id')->where($_GET)->find();
        $_GET['suggest_status'] = 2;
        M('suggest')->save($_GET);
        $this->assign('suggest_arr',$suggest_arr);
        $this->display();
    }
}